﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using BesAsm.MasterData.Entities;
using BesAsm.MasterData.Data;

#endregion

namespace BesAsm.MasterData.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="LinkProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class LinkProviderBaseCore : EntityProviderBase<BesAsm.MasterData.Entities.Link, BesAsm.MasterData.Entities.LinkKey>
	{		
		#region Get from Many To Many Relationship Functions
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, BesAsm.MasterData.Entities.LinkKey key)
		{
			return Delete(transactionManager, key.LinkId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_linkId">Primary key. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _linkId)
		{
			return Delete(null, _linkId);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkId">Primary key. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _linkId);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_HANSEN_SERVICE_CODES key.
		///		FK_LINKS_HANSEN_SERVICE_CODES Description: 
		/// </summary>
		/// <param name="_hansenServiceStatus">Foreign key to HANSEN_SERVICE_CODES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByHansenServiceStatus(System.String _hansenServiceStatus)
		{
			int count = -1;
			return GetByHansenServiceStatus(_hansenServiceStatus, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_HANSEN_SERVICE_CODES key.
		///		FK_LINKS_HANSEN_SERVICE_CODES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_hansenServiceStatus">Foreign key to HANSEN_SERVICE_CODES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		/// <remarks></remarks>
		public TList<Link> GetByHansenServiceStatus(TransactionManager transactionManager, System.String _hansenServiceStatus)
		{
			int count = -1;
			return GetByHansenServiceStatus(transactionManager, _hansenServiceStatus, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_HANSEN_SERVICE_CODES key.
		///		FK_LINKS_HANSEN_SERVICE_CODES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_hansenServiceStatus">Foreign key to HANSEN_SERVICE_CODES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByHansenServiceStatus(TransactionManager transactionManager, System.String _hansenServiceStatus, int start, int pageLength)
		{
			int count = -1;
			return GetByHansenServiceStatus(transactionManager, _hansenServiceStatus, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_HANSEN_SERVICE_CODES key.
		///		fkLinksHansenServiceCodes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_hansenServiceStatus">Foreign key to HANSEN_SERVICE_CODES</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByHansenServiceStatus(System.String _hansenServiceStatus, int start, int pageLength)
		{
			int count =  -1;
			return GetByHansenServiceStatus(null, _hansenServiceStatus, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_HANSEN_SERVICE_CODES key.
		///		fkLinksHansenServiceCodes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_hansenServiceStatus">Foreign key to HANSEN_SERVICE_CODES</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByHansenServiceStatus(System.String _hansenServiceStatus, int start, int pageLength,out int count)
		{
			return GetByHansenServiceStatus(null, _hansenServiceStatus, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_HANSEN_SERVICE_CODES key.
		///		FK_LINKS_HANSEN_SERVICE_CODES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_hansenServiceStatus">Foreign key to HANSEN_SERVICE_CODES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public abstract TList<Link> GetByHansenServiceStatus(TransactionManager transactionManager, System.String _hansenServiceStatus, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_LINK_TYPES key.
		///		FK_LINKS_LINK_TYPES Description: 
		/// </summary>
		/// <param name="_linkType">Foreign key to LINK_TYPES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByLinkType(System.String _linkType)
		{
			int count = -1;
			return GetByLinkType(_linkType, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_LINK_TYPES key.
		///		FK_LINKS_LINK_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkType">Foreign key to LINK_TYPES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		/// <remarks></remarks>
		public TList<Link> GetByLinkType(TransactionManager transactionManager, System.String _linkType)
		{
			int count = -1;
			return GetByLinkType(transactionManager, _linkType, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_LINK_TYPES key.
		///		FK_LINKS_LINK_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkType">Foreign key to LINK_TYPES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByLinkType(TransactionManager transactionManager, System.String _linkType, int start, int pageLength)
		{
			int count = -1;
			return GetByLinkType(transactionManager, _linkType, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_LINK_TYPES key.
		///		fkLinksLinkTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_linkType">Foreign key to LINK_TYPES</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByLinkType(System.String _linkType, int start, int pageLength)
		{
			int count =  -1;
			return GetByLinkType(null, _linkType, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_LINK_TYPES key.
		///		fkLinksLinkTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_linkType">Foreign key to LINK_TYPES</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByLinkType(System.String _linkType, int start, int pageLength,out int count)
		{
			return GetByLinkType(null, _linkType, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_LINK_TYPES key.
		///		FK_LINKS_LINK_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkType">Foreign key to LINK_TYPES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public abstract TList<Link> GetByLinkType(TransactionManager transactionManager, System.String _linkType, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_MATERIALS key.
		///		FK_LINKS_MATERIALS Description: 
		/// </summary>
		/// <param name="_material">Foreign key to MATERIALS</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByMaterial(System.String _material)
		{
			int count = -1;
			return GetByMaterial(_material, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_MATERIALS key.
		///		FK_LINKS_MATERIALS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_material">Foreign key to MATERIALS</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		/// <remarks></remarks>
		public TList<Link> GetByMaterial(TransactionManager transactionManager, System.String _material)
		{
			int count = -1;
			return GetByMaterial(transactionManager, _material, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_MATERIALS key.
		///		FK_LINKS_MATERIALS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_material">Foreign key to MATERIALS</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByMaterial(TransactionManager transactionManager, System.String _material, int start, int pageLength)
		{
			int count = -1;
			return GetByMaterial(transactionManager, _material, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_MATERIALS key.
		///		fkLinksMaterials Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_material">Foreign key to MATERIALS</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByMaterial(System.String _material, int start, int pageLength)
		{
			int count =  -1;
			return GetByMaterial(null, _material, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_MATERIALS key.
		///		fkLinksMaterials Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_material">Foreign key to MATERIALS</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByMaterial(System.String _material, int start, int pageLength,out int count)
		{
			return GetByMaterial(null, _material, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_MATERIALS key.
		///		FK_LINKS_MATERIALS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_material">Foreign key to MATERIALS</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public abstract TList<Link> GetByMaterial(TransactionManager transactionManager, System.String _material, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_DS key.
		///		FK_LINKS_NODES_DS Description: 
		/// </summary>
		/// <param name="_dsNodeId">Downstream node ID, foreign key to NODES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByDsNodeId(System.Int32 _dsNodeId)
		{
			int count = -1;
			return GetByDsNodeId(_dsNodeId, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_DS key.
		///		FK_LINKS_NODES_DS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_dsNodeId">Downstream node ID, foreign key to NODES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		/// <remarks></remarks>
		public TList<Link> GetByDsNodeId(TransactionManager transactionManager, System.Int32 _dsNodeId)
		{
			int count = -1;
			return GetByDsNodeId(transactionManager, _dsNodeId, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_DS key.
		///		FK_LINKS_NODES_DS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_dsNodeId">Downstream node ID, foreign key to NODES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByDsNodeId(TransactionManager transactionManager, System.Int32 _dsNodeId, int start, int pageLength)
		{
			int count = -1;
			return GetByDsNodeId(transactionManager, _dsNodeId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_DS key.
		///		fkLinksNodesDs Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_dsNodeId">Downstream node ID, foreign key to NODES</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByDsNodeId(System.Int32 _dsNodeId, int start, int pageLength)
		{
			int count =  -1;
			return GetByDsNodeId(null, _dsNodeId, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_DS key.
		///		fkLinksNodesDs Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_dsNodeId">Downstream node ID, foreign key to NODES</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByDsNodeId(System.Int32 _dsNodeId, int start, int pageLength,out int count)
		{
			return GetByDsNodeId(null, _dsNodeId, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_DS key.
		///		FK_LINKS_NODES_DS Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_dsNodeId">Downstream node ID, foreign key to NODES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public abstract TList<Link> GetByDsNodeId(TransactionManager transactionManager, System.Int32 _dsNodeId, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_US key.
		///		FK_LINKS_NODES_US Description: 
		/// </summary>
		/// <param name="_usNodeId">Upstream node ID, foreign key to NODES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByUsNodeId(System.Int32 _usNodeId)
		{
			int count = -1;
			return GetByUsNodeId(_usNodeId, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_US key.
		///		FK_LINKS_NODES_US Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_usNodeId">Upstream node ID, foreign key to NODES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		/// <remarks></remarks>
		public TList<Link> GetByUsNodeId(TransactionManager transactionManager, System.Int32 _usNodeId)
		{
			int count = -1;
			return GetByUsNodeId(transactionManager, _usNodeId, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_US key.
		///		FK_LINKS_NODES_US Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_usNodeId">Upstream node ID, foreign key to NODES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByUsNodeId(TransactionManager transactionManager, System.Int32 _usNodeId, int start, int pageLength)
		{
			int count = -1;
			return GetByUsNodeId(transactionManager, _usNodeId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_US key.
		///		fkLinksNodesUs Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_usNodeId">Upstream node ID, foreign key to NODES</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByUsNodeId(System.Int32 _usNodeId, int start, int pageLength)
		{
			int count =  -1;
			return GetByUsNodeId(null, _usNodeId, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_US key.
		///		fkLinksNodesUs Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_usNodeId">Upstream node ID, foreign key to NODES</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByUsNodeId(System.Int32 _usNodeId, int start, int pageLength,out int count)
		{
			return GetByUsNodeId(null, _usNodeId, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_NODES_US key.
		///		FK_LINKS_NODES_US Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_usNodeId">Upstream node ID, foreign key to NODES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public abstract TList<Link> GetByUsNodeId(TransactionManager transactionManager, System.Int32 _usNodeId, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_FLOW_TYPES key.
		///		FK_LINKS_PIPE_FLOW_TYPES Description: 
		/// </summary>
		/// <param name="_pipeFlowType">Foreign key to PIPE_FLOW_TYPES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByPipeFlowType(System.String _pipeFlowType)
		{
			int count = -1;
			return GetByPipeFlowType(_pipeFlowType, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_FLOW_TYPES key.
		///		FK_LINKS_PIPE_FLOW_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pipeFlowType">Foreign key to PIPE_FLOW_TYPES</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		/// <remarks></remarks>
		public TList<Link> GetByPipeFlowType(TransactionManager transactionManager, System.String _pipeFlowType)
		{
			int count = -1;
			return GetByPipeFlowType(transactionManager, _pipeFlowType, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_FLOW_TYPES key.
		///		FK_LINKS_PIPE_FLOW_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pipeFlowType">Foreign key to PIPE_FLOW_TYPES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByPipeFlowType(TransactionManager transactionManager, System.String _pipeFlowType, int start, int pageLength)
		{
			int count = -1;
			return GetByPipeFlowType(transactionManager, _pipeFlowType, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_FLOW_TYPES key.
		///		fkLinksPipeFlowTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_pipeFlowType">Foreign key to PIPE_FLOW_TYPES</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByPipeFlowType(System.String _pipeFlowType, int start, int pageLength)
		{
			int count =  -1;
			return GetByPipeFlowType(null, _pipeFlowType, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_FLOW_TYPES key.
		///		fkLinksPipeFlowTypes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_pipeFlowType">Foreign key to PIPE_FLOW_TYPES</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByPipeFlowType(System.String _pipeFlowType, int start, int pageLength,out int count)
		{
			return GetByPipeFlowType(null, _pipeFlowType, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_FLOW_TYPES key.
		///		FK_LINKS_PIPE_FLOW_TYPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pipeFlowType">Foreign key to PIPE_FLOW_TYPES</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public abstract TList<Link> GetByPipeFlowType(TransactionManager transactionManager, System.String _pipeFlowType, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_SHAPES key.
		///		FK_LINKS_PIPE_SHAPES Description: 
		/// </summary>
		/// <param name="_pipeShape">Pipe shape</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByPipeShape(System.Int32? _pipeShape)
		{
			int count = -1;
			return GetByPipeShape(_pipeShape, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_SHAPES key.
		///		FK_LINKS_PIPE_SHAPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pipeShape">Pipe shape</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		/// <remarks></remarks>
		public TList<Link> GetByPipeShape(TransactionManager transactionManager, System.Int32? _pipeShape)
		{
			int count = -1;
			return GetByPipeShape(transactionManager, _pipeShape, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_SHAPES key.
		///		FK_LINKS_PIPE_SHAPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pipeShape">Pipe shape</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByPipeShape(TransactionManager transactionManager, System.Int32? _pipeShape, int start, int pageLength)
		{
			int count = -1;
			return GetByPipeShape(transactionManager, _pipeShape, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_SHAPES key.
		///		fkLinksPipeShapes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_pipeShape">Pipe shape</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByPipeShape(System.Int32? _pipeShape, int start, int pageLength)
		{
			int count =  -1;
			return GetByPipeShape(null, _pipeShape, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_SHAPES key.
		///		fkLinksPipeShapes Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_pipeShape">Pipe shape</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByPipeShape(System.Int32? _pipeShape, int start, int pageLength,out int count)
		{
			return GetByPipeShape(null, _pipeShape, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_PIPE_SHAPES key.
		///		FK_LINKS_PIPE_SHAPES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_pipeShape">Pipe shape</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public abstract TList<Link> GetByPipeShape(TransactionManager transactionManager, System.Int32? _pipeShape, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_STATUSES key.
		///		FK_LINKS_STATUSES Description: 
		/// </summary>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByStatus(System.String _status)
		{
			int count = -1;
			return GetByStatus(_status, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_STATUSES key.
		///		FK_LINKS_STATUSES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		/// <remarks></remarks>
		public TList<Link> GetByStatus(TransactionManager transactionManager, System.String _status)
		{
			int count = -1;
			return GetByStatus(transactionManager, _status, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_STATUSES key.
		///		FK_LINKS_STATUSES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByStatus(TransactionManager transactionManager, System.String _status, int start, int pageLength)
		{
			int count = -1;
			return GetByStatus(transactionManager, _status, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_STATUSES key.
		///		fkLinksStatuses Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByStatus(System.String _status, int start, int pageLength)
		{
			int count =  -1;
			return GetByStatus(null, _status, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_STATUSES key.
		///		fkLinksStatuses Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public TList<Link> GetByStatus(System.String _status, int start, int pageLength,out int count)
		{
			return GetByStatus(null, _status, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_LINKS_STATUSES key.
		///		FK_LINKS_STATUSES Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_status">Status of record, in terms of usability for further analysis and general state of data</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of BesAsm.MasterData.Entities.Link objects.</returns>
		public abstract TList<Link> GetByStatus(TransactionManager transactionManager, System.String _status, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override BesAsm.MasterData.Entities.Link Get(TransactionManager transactionManager, BesAsm.MasterData.Entities.LinkKey key, int start, int pageLength)
		{
			return GetByLinkId(transactionManager, key.LinkId, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_LINKS index.
		/// </summary>
		/// <param name="_linkId">Primary key</param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkId(System.Int32 _linkId)
		{
			int count = -1;
			return GetByLinkId(null,_linkId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_LINKS index.
		/// </summary>
		/// <param name="_linkId">Primary key</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkId(System.Int32 _linkId, int start, int pageLength)
		{
			int count = -1;
			return GetByLinkId(null, _linkId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_LINKS index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkId">Primary key</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkId(TransactionManager transactionManager, System.Int32 _linkId)
		{
			int count = -1;
			return GetByLinkId(transactionManager, _linkId, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_LINKS index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkId">Primary key</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkId(TransactionManager transactionManager, System.Int32 _linkId, int start, int pageLength)
		{
			int count = -1;
			return GetByLinkId(transactionManager, _linkId, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_LINKS index.
		/// </summary>
		/// <param name="_linkId">Primary key</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkId(System.Int32 _linkId, int start, int pageLength, out int count)
		{
			return GetByLinkId(null, _linkId, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_LINKS index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkId">Primary key</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public abstract BesAsm.MasterData.Entities.Link GetByLinkId(TransactionManager transactionManager, System.Int32 _linkId, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key R142_ROWID_SDE_UK index.
		/// </summary>
		/// <param name="_objectid"></param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByObjectid(System.Int32 _objectid)
		{
			int count = -1;
			return GetByObjectid(null,_objectid, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the R142_ROWID_SDE_UK index.
		/// </summary>
		/// <param name="_objectid"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByObjectid(System.Int32 _objectid, int start, int pageLength)
		{
			int count = -1;
			return GetByObjectid(null, _objectid, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the R142_ROWID_SDE_UK index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_objectid"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByObjectid(TransactionManager transactionManager, System.Int32 _objectid)
		{
			int count = -1;
			return GetByObjectid(transactionManager, _objectid, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the R142_ROWID_SDE_UK index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_objectid"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByObjectid(TransactionManager transactionManager, System.Int32 _objectid, int start, int pageLength)
		{
			int count = -1;
			return GetByObjectid(transactionManager, _objectid, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the R142_ROWID_SDE_UK index.
		/// </summary>
		/// <param name="_objectid"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByObjectid(System.Int32 _objectid, int start, int pageLength, out int count)
		{
			return GetByObjectid(null, _objectid, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the R142_ROWID_SDE_UK index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_objectid"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public abstract BesAsm.MasterData.Entities.Link GetByObjectid(TransactionManager transactionManager, System.Int32 _objectid, int start, int pageLength, out int count);
						
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key UQ_LINKS_link_name index.
		/// </summary>
		/// <param name="_linkName">Primary key, link ID</param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkName(System.String _linkName)
		{
			int count = -1;
			return GetByLinkName(null,_linkName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the UQ_LINKS_link_name index.
		/// </summary>
		/// <param name="_linkName">Primary key, link ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkName(System.String _linkName, int start, int pageLength)
		{
			int count = -1;
			return GetByLinkName(null, _linkName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the UQ_LINKS_link_name index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkName">Primary key, link ID</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkName(TransactionManager transactionManager, System.String _linkName)
		{
			int count = -1;
			return GetByLinkName(transactionManager, _linkName, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the UQ_LINKS_link_name index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkName">Primary key, link ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkName(TransactionManager transactionManager, System.String _linkName, int start, int pageLength)
		{
			int count = -1;
			return GetByLinkName(transactionManager, _linkName, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the UQ_LINKS_link_name index.
		/// </summary>
		/// <param name="_linkName">Primary key, link ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public BesAsm.MasterData.Entities.Link GetByLinkName(System.String _linkName, int start, int pageLength, out int count)
		{
			return GetByLinkName(null, _linkName, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the UQ_LINKS_link_name index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_linkName">Primary key, link ID</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="BesAsm.MasterData.Entities.Link"/> class.</returns>
		public abstract BesAsm.MasterData.Entities.Link GetByLinkName(TransactionManager transactionManager, System.String _linkName, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#region USP_LINKS_SELECT_BY_OIDS 
		
		/// <summary>
		///	This method wrap the 'USP_LINKS_SELECT_BY_OIDS' stored procedure. 
		/// </summary>
		/// <param name="idTable"> A <c>System.Object</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Link&gt;"/> instance.</returns>
		public TList<Link> SelectByOids(System.Object idTable)
		{
			return SelectByOids(null, 0, int.MaxValue , idTable);
		}
		
		/// <summary>
		///	This method wrap the 'USP_LINKS_SELECT_BY_OIDS' stored procedure. 
		/// </summary>
		/// <param name="idTable"> A <c>System.Object</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Link&gt;"/> instance.</returns>
		public TList<Link> SelectByOids(int start, int pageLength, System.Object idTable)
		{
			return SelectByOids(null, start, pageLength , idTable);
		}
				
		/// <summary>
		///	This method wrap the 'USP_LINKS_SELECT_BY_OIDS' stored procedure. 
		/// </summary>
		/// <param name="idTable"> A <c>System.Object</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Link&gt;"/> instance.</returns>
		public TList<Link> SelectByOids(TransactionManager transactionManager, System.Object idTable)
		{
			return SelectByOids(transactionManager, 0, int.MaxValue , idTable);
		}
		
		/// <summary>
		///	This method wrap the 'USP_LINKS_SELECT_BY_OIDS' stored procedure. 
		/// </summary>
		/// <param name="idTable"> A <c>System.Object</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="TList&lt;Link&gt;"/> instance.</returns>
		public abstract TList<Link> SelectByOids(TransactionManager transactionManager, int start, int pageLength , System.Object idTable);
		
		#endregion
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;Link&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;Link&gt;"/></returns>
		public static TList<Link> Fill(IDataReader reader, TList<Link> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				BesAsm.MasterData.Entities.Link c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("Link")
					.Append("|").Append((System.Int32)reader[((int)LinkColumn.LinkId - 1)]).ToString();
					c = EntityManager.LocateOrCreate<Link>(
					key.ToString(), // EntityTrackingKey
					"Link",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new BesAsm.MasterData.Entities.Link();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.Objectid = (System.Int32)reader[((int)LinkColumn.Objectid - 1)];
					c.LinkName = (System.String)reader[((int)LinkColumn.LinkName - 1)];
					c.HansenCompkey = (reader.IsDBNull(((int)LinkColumn.HansenCompkey - 1)))?null:(System.Int32?)reader[((int)LinkColumn.HansenCompkey - 1)];
					c.UsNodeId = (System.Int32)reader[((int)LinkColumn.UsNodeId - 1)];
					c.DsNodeId = (System.Int32)reader[((int)LinkColumn.DsNodeId - 1)];
					c.PipeShape = (reader.IsDBNull(((int)LinkColumn.PipeShape - 1)))?null:(System.Int32?)reader[((int)LinkColumn.PipeShape - 1)];
					c.LinkType = (reader.IsDBNull(((int)LinkColumn.LinkType - 1)))?null:(System.String)reader[((int)LinkColumn.LinkType - 1)];
					c.PipeFlowType = (reader.IsDBNull(((int)LinkColumn.PipeFlowType - 1)))?null:(System.String)reader[((int)LinkColumn.PipeFlowType - 1)];
					c.Length = (reader.IsDBNull(((int)LinkColumn.Length - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.Length - 1)];
					c.DiameterOrWidthIn = (reader.IsDBNull(((int)LinkColumn.DiameterOrWidthIn - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DiameterOrWidthIn - 1)];
					c.HeightIn = (reader.IsDBNull(((int)LinkColumn.HeightIn - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.HeightIn - 1)];
					c.Material = (System.String)reader[((int)LinkColumn.Material - 1)];
					c.UsDepth = (reader.IsDBNull(((int)LinkColumn.UsDepth - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.UsDepth - 1)];
					c.DsDepth = (reader.IsDBNull(((int)LinkColumn.DsDepth - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DsDepth - 1)];
					c.UsInvert = (reader.IsDBNull(((int)LinkColumn.UsInvert - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.UsInvert - 1)];
					c.DsInvert = (reader.IsDBNull(((int)LinkColumn.DsInvert - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DsInvert - 1)];
					c.AsBuiltId = (reader.IsDBNull(((int)LinkColumn.AsBuiltId - 1)))?null:(System.String)reader[((int)LinkColumn.AsBuiltId - 1)];
					c.ConstructedDate = (reader.IsDBNull(((int)LinkColumn.ConstructedDate - 1)))?null:(System.DateTime?)reader[((int)LinkColumn.ConstructedDate - 1)];
					c.UsXCoord = (reader.IsDBNull(((int)LinkColumn.UsXCoord - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.UsXCoord - 1)];
					c.UsYCoord = (reader.IsDBNull(((int)LinkColumn.UsYCoord - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.UsYCoord - 1)];
					c.DsXCoord = (reader.IsDBNull(((int)LinkColumn.DsXCoord - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DsXCoord - 1)];
					c.DsYCoord = (reader.IsDBNull(((int)LinkColumn.DsYCoord - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DsYCoord - 1)];
					c.Roughness = (System.Decimal)reader[((int)LinkColumn.Roughness - 1)];
					c.TimeFrame = (reader.IsDBNull(((int)LinkColumn.TimeFrame - 1)))?null:(System.String)reader[((int)LinkColumn.TimeFrame - 1)];
					c.MrdResult = (reader.IsDBNull(((int)LinkColumn.MrdResult - 1)))?null:(System.Int32?)reader[((int)LinkColumn.MrdResult - 1)];
					c.DataQuality = (reader.IsDBNull(((int)LinkColumn.DataQuality - 1)))?null:(System.String)reader[((int)LinkColumn.DataQuality - 1)];
					c.UsNodeNameDeprecated = (reader.IsDBNull(((int)LinkColumn.UsNodeNameDeprecated - 1)))?null:(System.String)reader[((int)LinkColumn.UsNodeNameDeprecated - 1)];
					c.DsNodeNameDeprecated = (reader.IsDBNull(((int)LinkColumn.DsNodeNameDeprecated - 1)))?null:(System.String)reader[((int)LinkColumn.DsNodeNameDeprecated - 1)];
					c.HansenServiceStatus = (reader.IsDBNull(((int)LinkColumn.HansenServiceStatus - 1)))?null:(System.String)reader[((int)LinkColumn.HansenServiceStatus - 1)];
					c.ValidFromDate = (reader.IsDBNull(((int)LinkColumn.ValidFromDate - 1)))?null:(System.String)reader[((int)LinkColumn.ValidFromDate - 1)];
					c.ValidToDate = (reader.IsDBNull(((int)LinkColumn.ValidToDate - 1)))?null:(System.String)reader[((int)LinkColumn.ValidToDate - 1)];
					c.CadKey = (reader.IsDBNull(((int)LinkColumn.CadKey - 1)))?null:(System.String)reader[((int)LinkColumn.CadKey - 1)];
					c.AuditNodeId = (reader.IsDBNull(((int)LinkColumn.AuditNodeId - 1)))?null:(System.String)reader[((int)LinkColumn.AuditNodeId - 1)];
					c.AuditDups = (reader.IsDBNull(((int)LinkColumn.AuditDups - 1)))?null:(System.String)reader[((int)LinkColumn.AuditDups - 1)];
					c.AuditSpatial = (reader.IsDBNull(((int)LinkColumn.AuditSpatial - 1)))?null:(System.String)reader[((int)LinkColumn.AuditSpatial - 1)];
					c.AuditPassed = (reader.IsDBNull(((int)LinkColumn.AuditPassed - 1)))?null:(System.Int32?)reader[((int)LinkColumn.AuditPassed - 1)];
					c.AuditProcessedTimestamp = (reader.IsDBNull(((int)LinkColumn.AuditProcessedTimestamp - 1)))?null:(System.String)reader[((int)LinkColumn.AuditProcessedTimestamp - 1)];
					c.DesignFlow = (reader.IsDBNull(((int)LinkColumn.DesignFlow - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DesignFlow - 1)];
					c.DmeGlobalId = (reader.IsDBNull(((int)LinkColumn.DmeGlobalId - 1)))?null:(System.Int32?)reader[((int)LinkColumn.DmeGlobalId - 1)];
					c.PipeShapeDeprecated = (reader.IsDBNull(((int)LinkColumn.PipeShapeDeprecated - 1)))?null:(System.String)reader[((int)LinkColumn.PipeShapeDeprecated - 1)];
					c.EditedBy = (System.String)reader[((int)LinkColumn.EditedBy - 1)];
					c.EditReason = (System.String)reader[((int)LinkColumn.EditReason - 1)];
					c.Status = (System.String)reader[((int)LinkColumn.Status - 1)];
					c.AppendDate = (System.DateTime)reader[((int)LinkColumn.AppendDate - 1)];
					c.EditDate = (reader.IsDBNull(((int)LinkColumn.EditDate - 1)))?null:(System.DateTime?)reader[((int)LinkColumn.EditDate - 1)];
					c.LinkId = (System.Int32)reader[((int)LinkColumn.LinkId - 1)];
					c.OriginalLinkId = c.LinkId;
					c.MlinkidDeprecated = (reader.IsDBNull(((int)LinkColumn.MlinkidDeprecated - 1)))?null:(System.Int32?)reader[((int)LinkColumn.MlinkidDeprecated - 1)];
					c.Shape = (reader.IsDBNull(((int)LinkColumn.Shape - 1)))?null:(System.Object)reader[((int)LinkColumn.Shape - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="BesAsm.MasterData.Entities.Link"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="BesAsm.MasterData.Entities.Link"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, BesAsm.MasterData.Entities.Link entity)
		{
			if (!reader.Read()) return;
			
			entity.Objectid = (System.Int32)reader[((int)LinkColumn.Objectid - 1)];
			entity.LinkName = (System.String)reader[((int)LinkColumn.LinkName - 1)];
			entity.HansenCompkey = (reader.IsDBNull(((int)LinkColumn.HansenCompkey - 1)))?null:(System.Int32?)reader[((int)LinkColumn.HansenCompkey - 1)];
			entity.UsNodeId = (System.Int32)reader[((int)LinkColumn.UsNodeId - 1)];
			entity.DsNodeId = (System.Int32)reader[((int)LinkColumn.DsNodeId - 1)];
			entity.PipeShape = (reader.IsDBNull(((int)LinkColumn.PipeShape - 1)))?null:(System.Int32?)reader[((int)LinkColumn.PipeShape - 1)];
			entity.LinkType = (reader.IsDBNull(((int)LinkColumn.LinkType - 1)))?null:(System.String)reader[((int)LinkColumn.LinkType - 1)];
			entity.PipeFlowType = (reader.IsDBNull(((int)LinkColumn.PipeFlowType - 1)))?null:(System.String)reader[((int)LinkColumn.PipeFlowType - 1)];
			entity.Length = (reader.IsDBNull(((int)LinkColumn.Length - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.Length - 1)];
			entity.DiameterOrWidthIn = (reader.IsDBNull(((int)LinkColumn.DiameterOrWidthIn - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DiameterOrWidthIn - 1)];
			entity.HeightIn = (reader.IsDBNull(((int)LinkColumn.HeightIn - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.HeightIn - 1)];
			entity.Material = (System.String)reader[((int)LinkColumn.Material - 1)];
			entity.UsDepth = (reader.IsDBNull(((int)LinkColumn.UsDepth - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.UsDepth - 1)];
			entity.DsDepth = (reader.IsDBNull(((int)LinkColumn.DsDepth - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DsDepth - 1)];
			entity.UsInvert = (reader.IsDBNull(((int)LinkColumn.UsInvert - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.UsInvert - 1)];
			entity.DsInvert = (reader.IsDBNull(((int)LinkColumn.DsInvert - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DsInvert - 1)];
			entity.AsBuiltId = (reader.IsDBNull(((int)LinkColumn.AsBuiltId - 1)))?null:(System.String)reader[((int)LinkColumn.AsBuiltId - 1)];
			entity.ConstructedDate = (reader.IsDBNull(((int)LinkColumn.ConstructedDate - 1)))?null:(System.DateTime?)reader[((int)LinkColumn.ConstructedDate - 1)];
			entity.UsXCoord = (reader.IsDBNull(((int)LinkColumn.UsXCoord - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.UsXCoord - 1)];
			entity.UsYCoord = (reader.IsDBNull(((int)LinkColumn.UsYCoord - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.UsYCoord - 1)];
			entity.DsXCoord = (reader.IsDBNull(((int)LinkColumn.DsXCoord - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DsXCoord - 1)];
			entity.DsYCoord = (reader.IsDBNull(((int)LinkColumn.DsYCoord - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DsYCoord - 1)];
			entity.Roughness = (System.Decimal)reader[((int)LinkColumn.Roughness - 1)];
			entity.TimeFrame = (reader.IsDBNull(((int)LinkColumn.TimeFrame - 1)))?null:(System.String)reader[((int)LinkColumn.TimeFrame - 1)];
			entity.MrdResult = (reader.IsDBNull(((int)LinkColumn.MrdResult - 1)))?null:(System.Int32?)reader[((int)LinkColumn.MrdResult - 1)];
			entity.DataQuality = (reader.IsDBNull(((int)LinkColumn.DataQuality - 1)))?null:(System.String)reader[((int)LinkColumn.DataQuality - 1)];
			entity.UsNodeNameDeprecated = (reader.IsDBNull(((int)LinkColumn.UsNodeNameDeprecated - 1)))?null:(System.String)reader[((int)LinkColumn.UsNodeNameDeprecated - 1)];
			entity.DsNodeNameDeprecated = (reader.IsDBNull(((int)LinkColumn.DsNodeNameDeprecated - 1)))?null:(System.String)reader[((int)LinkColumn.DsNodeNameDeprecated - 1)];
			entity.HansenServiceStatus = (reader.IsDBNull(((int)LinkColumn.HansenServiceStatus - 1)))?null:(System.String)reader[((int)LinkColumn.HansenServiceStatus - 1)];
			entity.ValidFromDate = (reader.IsDBNull(((int)LinkColumn.ValidFromDate - 1)))?null:(System.String)reader[((int)LinkColumn.ValidFromDate - 1)];
			entity.ValidToDate = (reader.IsDBNull(((int)LinkColumn.ValidToDate - 1)))?null:(System.String)reader[((int)LinkColumn.ValidToDate - 1)];
			entity.CadKey = (reader.IsDBNull(((int)LinkColumn.CadKey - 1)))?null:(System.String)reader[((int)LinkColumn.CadKey - 1)];
			entity.AuditNodeId = (reader.IsDBNull(((int)LinkColumn.AuditNodeId - 1)))?null:(System.String)reader[((int)LinkColumn.AuditNodeId - 1)];
			entity.AuditDups = (reader.IsDBNull(((int)LinkColumn.AuditDups - 1)))?null:(System.String)reader[((int)LinkColumn.AuditDups - 1)];
			entity.AuditSpatial = (reader.IsDBNull(((int)LinkColumn.AuditSpatial - 1)))?null:(System.String)reader[((int)LinkColumn.AuditSpatial - 1)];
			entity.AuditPassed = (reader.IsDBNull(((int)LinkColumn.AuditPassed - 1)))?null:(System.Int32?)reader[((int)LinkColumn.AuditPassed - 1)];
			entity.AuditProcessedTimestamp = (reader.IsDBNull(((int)LinkColumn.AuditProcessedTimestamp - 1)))?null:(System.String)reader[((int)LinkColumn.AuditProcessedTimestamp - 1)];
			entity.DesignFlow = (reader.IsDBNull(((int)LinkColumn.DesignFlow - 1)))?null:(System.Decimal?)reader[((int)LinkColumn.DesignFlow - 1)];
			entity.DmeGlobalId = (reader.IsDBNull(((int)LinkColumn.DmeGlobalId - 1)))?null:(System.Int32?)reader[((int)LinkColumn.DmeGlobalId - 1)];
			entity.PipeShapeDeprecated = (reader.IsDBNull(((int)LinkColumn.PipeShapeDeprecated - 1)))?null:(System.String)reader[((int)LinkColumn.PipeShapeDeprecated - 1)];
			entity.EditedBy = (System.String)reader[((int)LinkColumn.EditedBy - 1)];
			entity.EditReason = (System.String)reader[((int)LinkColumn.EditReason - 1)];
			entity.Status = (System.String)reader[((int)LinkColumn.Status - 1)];
			entity.AppendDate = (System.DateTime)reader[((int)LinkColumn.AppendDate - 1)];
			entity.EditDate = (reader.IsDBNull(((int)LinkColumn.EditDate - 1)))?null:(System.DateTime?)reader[((int)LinkColumn.EditDate - 1)];
			entity.LinkId = (System.Int32)reader[((int)LinkColumn.LinkId - 1)];
			entity.OriginalLinkId = (System.Int32)reader["link_id"];
			entity.MlinkidDeprecated = (reader.IsDBNull(((int)LinkColumn.MlinkidDeprecated - 1)))?null:(System.Int32?)reader[((int)LinkColumn.MlinkidDeprecated - 1)];
			entity.Shape = (reader.IsDBNull(((int)LinkColumn.Shape - 1)))?null:(System.Object)reader[((int)LinkColumn.Shape - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="BesAsm.MasterData.Entities.Link"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="BesAsm.MasterData.Entities.Link"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, BesAsm.MasterData.Entities.Link entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.Objectid = (System.Int32)dataRow["OBJECTID"];
			entity.LinkName = (System.String)dataRow["link_name"];
			entity.HansenCompkey = Convert.IsDBNull(dataRow["hansen_compkey"]) ? null : (System.Int32?)dataRow["hansen_compkey"];
			entity.UsNodeId = (System.Int32)dataRow["us_node_id"];
			entity.DsNodeId = (System.Int32)dataRow["ds_node_id"];
			entity.PipeShape = Convert.IsDBNull(dataRow["pipe_shape"]) ? null : (System.Int32?)dataRow["pipe_shape"];
			entity.LinkType = Convert.IsDBNull(dataRow["link_type"]) ? null : (System.String)dataRow["link_type"];
			entity.PipeFlowType = Convert.IsDBNull(dataRow["pipe_flow_type"]) ? null : (System.String)dataRow["pipe_flow_type"];
			entity.Length = Convert.IsDBNull(dataRow["length"]) ? null : (System.Decimal?)dataRow["length"];
			entity.DiameterOrWidthIn = Convert.IsDBNull(dataRow["diameter_or_width_in"]) ? null : (System.Decimal?)dataRow["diameter_or_width_in"];
			entity.HeightIn = Convert.IsDBNull(dataRow["height_in"]) ? null : (System.Decimal?)dataRow["height_in"];
			entity.Material = (System.String)dataRow["material"];
			entity.UsDepth = Convert.IsDBNull(dataRow["us_depth"]) ? null : (System.Decimal?)dataRow["us_depth"];
			entity.DsDepth = Convert.IsDBNull(dataRow["ds_depth"]) ? null : (System.Decimal?)dataRow["ds_depth"];
			entity.UsInvert = Convert.IsDBNull(dataRow["us_invert"]) ? null : (System.Decimal?)dataRow["us_invert"];
			entity.DsInvert = Convert.IsDBNull(dataRow["ds_invert"]) ? null : (System.Decimal?)dataRow["ds_invert"];
			entity.AsBuiltId = Convert.IsDBNull(dataRow["as_built_id"]) ? null : (System.String)dataRow["as_built_id"];
			entity.ConstructedDate = Convert.IsDBNull(dataRow["constructed_date"]) ? null : (System.DateTime?)dataRow["constructed_date"];
			entity.UsXCoord = Convert.IsDBNull(dataRow["us_x_coord"]) ? null : (System.Decimal?)dataRow["us_x_coord"];
			entity.UsYCoord = Convert.IsDBNull(dataRow["us_y_coord"]) ? null : (System.Decimal?)dataRow["us_y_coord"];
			entity.DsXCoord = Convert.IsDBNull(dataRow["ds_x_coord"]) ? null : (System.Decimal?)dataRow["ds_x_coord"];
			entity.DsYCoord = Convert.IsDBNull(dataRow["ds_y_coord"]) ? null : (System.Decimal?)dataRow["ds_y_coord"];
			entity.Roughness = (System.Decimal)dataRow["roughness"];
			entity.TimeFrame = Convert.IsDBNull(dataRow["time_frame"]) ? null : (System.String)dataRow["time_frame"];
			entity.MrdResult = Convert.IsDBNull(dataRow["mrd_result"]) ? null : (System.Int32?)dataRow["mrd_result"];
			entity.DataQuality = Convert.IsDBNull(dataRow["data_quality"]) ? null : (System.String)dataRow["data_quality"];
			entity.UsNodeNameDeprecated = Convert.IsDBNull(dataRow["us_node_name_deprecated"]) ? null : (System.String)dataRow["us_node_name_deprecated"];
			entity.DsNodeNameDeprecated = Convert.IsDBNull(dataRow["ds_node_name_deprecated"]) ? null : (System.String)dataRow["ds_node_name_deprecated"];
			entity.HansenServiceStatus = Convert.IsDBNull(dataRow["hansen_service_status"]) ? null : (System.String)dataRow["hansen_service_status"];
			entity.ValidFromDate = Convert.IsDBNull(dataRow["valid_from_date"]) ? null : (System.String)dataRow["valid_from_date"];
			entity.ValidToDate = Convert.IsDBNull(dataRow["valid_to_date"]) ? null : (System.String)dataRow["valid_to_date"];
			entity.CadKey = Convert.IsDBNull(dataRow["cad_key"]) ? null : (System.String)dataRow["cad_key"];
			entity.AuditNodeId = Convert.IsDBNull(dataRow["audit_node_id"]) ? null : (System.String)dataRow["audit_node_id"];
			entity.AuditDups = Convert.IsDBNull(dataRow["audit_dups"]) ? null : (System.String)dataRow["audit_dups"];
			entity.AuditSpatial = Convert.IsDBNull(dataRow["audit_spatial"]) ? null : (System.String)dataRow["audit_spatial"];
			entity.AuditPassed = Convert.IsDBNull(dataRow["audit_passed"]) ? null : (System.Int32?)dataRow["audit_passed"];
			entity.AuditProcessedTimestamp = Convert.IsDBNull(dataRow["audit_processed_timestamp"]) ? null : (System.String)dataRow["audit_processed_timestamp"];
			entity.DesignFlow = Convert.IsDBNull(dataRow["design_flow"]) ? null : (System.Decimal?)dataRow["design_flow"];
			entity.DmeGlobalId = Convert.IsDBNull(dataRow["dme_global_id"]) ? null : (System.Int32?)dataRow["dme_global_id"];
			entity.PipeShapeDeprecated = Convert.IsDBNull(dataRow["pipe_shape_deprecated"]) ? null : (System.String)dataRow["pipe_shape_deprecated"];
			entity.EditedBy = (System.String)dataRow["edited_by"];
			entity.EditReason = (System.String)dataRow["edit_reason"];
			entity.Status = (System.String)dataRow["status"];
			entity.AppendDate = (System.DateTime)dataRow["append_date"];
			entity.EditDate = Convert.IsDBNull(dataRow["edit_date"]) ? null : (System.DateTime?)dataRow["edit_date"];
			entity.LinkId = (System.Int32)dataRow["link_id"];
			entity.OriginalLinkId = (System.Int32)dataRow["link_id"];
			entity.MlinkidDeprecated = Convert.IsDBNull(dataRow["mlinkid_deprecated"]) ? null : (System.Int32?)dataRow["mlinkid_deprecated"];
			entity.Shape = Convert.IsDBNull(dataRow["SHAPE"]) ? null : (System.Object)dataRow["SHAPE"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="BesAsm.MasterData.Entities.Link"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">BesAsm.MasterData.Entities.Link Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, BesAsm.MasterData.Entities.Link entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region HansenServiceStatusSource	
			if (CanDeepLoad(entity, "HansenServiceCode|HansenServiceStatusSource", deepLoadType, innerList) 
				&& entity.HansenServiceStatusSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.HansenServiceStatus ?? string.Empty);
				HansenServiceCode tmpEntity = EntityManager.LocateEntity<HansenServiceCode>(EntityLocator.ConstructKeyFromPkItems(typeof(HansenServiceCode), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.HansenServiceStatusSource = tmpEntity;
				else
					entity.HansenServiceStatusSource = DataRepository.HansenServiceCodeProvider.GetByHansenServiceCodeId(transactionManager, (entity.HansenServiceStatus ?? string.Empty));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'HansenServiceStatusSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.HansenServiceStatusSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.HansenServiceCodeProvider.DeepLoad(transactionManager, entity.HansenServiceStatusSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion HansenServiceStatusSource

			#region LinkTypeSource	
			if (CanDeepLoad(entity, "LinkType|LinkTypeSource", deepLoadType, innerList) 
				&& entity.LinkTypeSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.LinkType ?? string.Empty);
				LinkType tmpEntity = EntityManager.LocateEntity<LinkType>(EntityLocator.ConstructKeyFromPkItems(typeof(LinkType), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.LinkTypeSource = tmpEntity;
				else
					entity.LinkTypeSource = DataRepository.LinkTypeProvider.GetByLinkTypeId(transactionManager, (entity.LinkType ?? string.Empty));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'LinkTypeSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.LinkTypeSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.LinkTypeProvider.DeepLoad(transactionManager, entity.LinkTypeSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion LinkTypeSource

			#region MaterialSource	
			if (CanDeepLoad(entity, "Material|MaterialSource", deepLoadType, innerList) 
				&& entity.MaterialSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.Material;
				Material tmpEntity = EntityManager.LocateEntity<Material>(EntityLocator.ConstructKeyFromPkItems(typeof(Material), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.MaterialSource = tmpEntity;
				else
					entity.MaterialSource = DataRepository.MaterialProvider.GetByMaterialId(transactionManager, entity.Material);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'MaterialSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.MaterialSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.MaterialProvider.DeepLoad(transactionManager, entity.MaterialSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion MaterialSource

			#region DsNodeIdSource	
			if (CanDeepLoad(entity, "Node|DsNodeIdSource", deepLoadType, innerList) 
				&& entity.DsNodeIdSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.DsNodeId;
				Node tmpEntity = EntityManager.LocateEntity<Node>(EntityLocator.ConstructKeyFromPkItems(typeof(Node), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.DsNodeIdSource = tmpEntity;
				else
					entity.DsNodeIdSource = DataRepository.NodeProvider.GetByNodeId(transactionManager, entity.DsNodeId);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DsNodeIdSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.DsNodeIdSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.NodeProvider.DeepLoad(transactionManager, entity.DsNodeIdSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion DsNodeIdSource

			#region UsNodeIdSource	
			if (CanDeepLoad(entity, "Node|UsNodeIdSource", deepLoadType, innerList) 
				&& entity.UsNodeIdSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.UsNodeId;
				Node tmpEntity = EntityManager.LocateEntity<Node>(EntityLocator.ConstructKeyFromPkItems(typeof(Node), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.UsNodeIdSource = tmpEntity;
				else
					entity.UsNodeIdSource = DataRepository.NodeProvider.GetByNodeId(transactionManager, entity.UsNodeId);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'UsNodeIdSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.UsNodeIdSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.NodeProvider.DeepLoad(transactionManager, entity.UsNodeIdSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion UsNodeIdSource

			#region PipeFlowTypeSource	
			if (CanDeepLoad(entity, "PipeFlowType|PipeFlowTypeSource", deepLoadType, innerList) 
				&& entity.PipeFlowTypeSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.PipeFlowType ?? string.Empty);
				PipeFlowType tmpEntity = EntityManager.LocateEntity<PipeFlowType>(EntityLocator.ConstructKeyFromPkItems(typeof(PipeFlowType), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.PipeFlowTypeSource = tmpEntity;
				else
					entity.PipeFlowTypeSource = DataRepository.PipeFlowTypeProvider.GetByPipeFlowTypeId(transactionManager, (entity.PipeFlowType ?? string.Empty));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PipeFlowTypeSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.PipeFlowTypeSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PipeFlowTypeProvider.DeepLoad(transactionManager, entity.PipeFlowTypeSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion PipeFlowTypeSource

			#region PipeShapeSource	
			if (CanDeepLoad(entity, "PipeShape|PipeShapeSource", deepLoadType, innerList) 
				&& entity.PipeShapeSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = (entity.PipeShape ?? (int)0);
				PipeShape tmpEntity = EntityManager.LocateEntity<PipeShape>(EntityLocator.ConstructKeyFromPkItems(typeof(PipeShape), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.PipeShapeSource = tmpEntity;
				else
					entity.PipeShapeSource = DataRepository.PipeShapeProvider.GetByShapeId(transactionManager, (entity.PipeShape ?? (int)0));		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PipeShapeSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.PipeShapeSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PipeShapeProvider.DeepLoad(transactionManager, entity.PipeShapeSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion PipeShapeSource

			#region StatusSource	
			if (CanDeepLoad(entity, "Status|StatusSource", deepLoadType, innerList) 
				&& entity.StatusSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.Status;
				Status tmpEntity = EntityManager.LocateEntity<Status>(EntityLocator.ConstructKeyFromPkItems(typeof(Status), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.StatusSource = tmpEntity;
				else
					entity.StatusSource = DataRepository.StatusProvider.GetByStatusId(transactionManager, entity.Status);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'StatusSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.StatusSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.StatusProvider.DeepLoad(transactionManager, entity.StatusSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion StatusSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByLinkId methods when available
			
			#region WeirCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Weir>|WeirCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'WeirCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.WeirCollection = DataRepository.WeirProvider.GetByLinkId(transactionManager, entity.LinkId);

				if (deep && entity.WeirCollection.Count > 0)
				{
					deepHandles.Add("WeirCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Weir>) DataRepository.WeirProvider.DeepLoad,
						new object[] { transactionManager, entity.WeirCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PumpCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Pump>|PumpCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PumpCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PumpCollection = DataRepository.PumpProvider.GetByLinkId(transactionManager, entity.LinkId);

				if (deep && entity.PumpCollection.Count > 0)
				{
					deepHandles.Add("PumpCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Pump>) DataRepository.PumpProvider.DeepLoad,
						new object[] { transactionManager, entity.PumpCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region DscCollectionGetByStormToLinkId
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Dsc>|DscCollectionGetByStormToLinkId", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DscCollectionGetByStormToLinkId' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.DscCollectionGetByStormToLinkId = DataRepository.DscProvider.GetByStormToLinkId(transactionManager, entity.LinkId);

				if (deep && entity.DscCollectionGetByStormToLinkId.Count > 0)
				{
					deepHandles.Add("DscCollectionGetByStormToLinkId",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Dsc>) DataRepository.DscProvider.DeepLoad,
						new object[] { transactionManager, entity.DscCollectionGetByStormToLinkId, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PipeConflictCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PipeConflict>|PipeConflictCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PipeConflictCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PipeConflictCollection = DataRepository.PipeConflictProvider.GetByLinkId(transactionManager, entity.LinkId);

				if (deep && entity.PipeConflictCollection.Count > 0)
				{
					deepHandles.Add("PipeConflictCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PipeConflict>) DataRepository.PipeConflictProvider.DeepLoad,
						new object[] { transactionManager, entity.PipeConflictCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region CrossSectionCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<CrossSection>|CrossSectionCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'CrossSectionCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.CrossSectionCollection = DataRepository.CrossSectionProvider.GetByLinkId(transactionManager, entity.LinkId);

				if (deep && entity.CrossSectionCollection.Count > 0)
				{
					deepHandles.Add("CrossSectionCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<CrossSection>) DataRepository.CrossSectionProvider.DeepLoad,
						new object[] { transactionManager, entity.CrossSectionCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region OrificeCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Orifice>|OrificeCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'OrificeCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.OrificeCollection = DataRepository.OrificeProvider.GetByLinkId(transactionManager, entity.LinkId);

				if (deep && entity.OrificeCollection.Count > 0)
				{
					deepHandles.Add("OrificeCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Orifice>) DataRepository.OrificeProvider.DeepLoad,
						new object[] { transactionManager, entity.OrificeCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region DscCollectionGetBySanToLinkId
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<Dsc>|DscCollectionGetBySanToLinkId", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DscCollectionGetBySanToLinkId' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.DscCollectionGetBySanToLinkId = DataRepository.DscProvider.GetBySanToLinkId(transactionManager, entity.LinkId);

				if (deep && entity.DscCollectionGetBySanToLinkId.Count > 0)
				{
					deepHandles.Add("DscCollectionGetBySanToLinkId",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<Dsc>) DataRepository.DscProvider.DeepLoad,
						new object[] { transactionManager, entity.DscCollectionGetBySanToLinkId, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region DscZingerCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<DscZinger>|DscZingerCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'DscZingerCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.DscZingerCollection = DataRepository.DscZingerProvider.GetByLinkId(transactionManager, entity.LinkId);

				if (deep && entity.DscZingerCollection.Count > 0)
				{
					deepHandles.Add("DscZingerCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<DscZinger>) DataRepository.DscZingerProvider.DeepLoad,
						new object[] { transactionManager, entity.DscZingerCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region SpecialLinkCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<SpecialLink>|SpecialLinkCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'SpecialLinkCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.SpecialLinkCollection = DataRepository.SpecialLinkProvider.GetByToLinkId(transactionManager, entity.LinkId);

				if (deep && entity.SpecialLinkCollection.Count > 0)
				{
					deepHandles.Add("SpecialLinkCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<SpecialLink>) DataRepository.SpecialLinkProvider.DeepLoad,
						new object[] { transactionManager, entity.SpecialLinkCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the BesAsm.MasterData.Entities.Link object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">BesAsm.MasterData.Entities.Link instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">BesAsm.MasterData.Entities.Link Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, BesAsm.MasterData.Entities.Link entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region HansenServiceStatusSource
			if (CanDeepSave(entity, "HansenServiceCode|HansenServiceStatusSource", deepSaveType, innerList) 
				&& entity.HansenServiceStatusSource != null)
			{
				DataRepository.HansenServiceCodeProvider.Save(transactionManager, entity.HansenServiceStatusSource);
				entity.HansenServiceStatus = entity.HansenServiceStatusSource.HansenServiceCodeId;
			}
			#endregion 
			
			#region LinkTypeSource
			if (CanDeepSave(entity, "LinkType|LinkTypeSource", deepSaveType, innerList) 
				&& entity.LinkTypeSource != null)
			{
				DataRepository.LinkTypeProvider.Save(transactionManager, entity.LinkTypeSource);
				entity.LinkType = entity.LinkTypeSource.LinkTypeId;
			}
			#endregion 
			
			#region MaterialSource
			if (CanDeepSave(entity, "Material|MaterialSource", deepSaveType, innerList) 
				&& entity.MaterialSource != null)
			{
				DataRepository.MaterialProvider.Save(transactionManager, entity.MaterialSource);
				entity.Material = entity.MaterialSource.MaterialId;
			}
			#endregion 
			
			#region DsNodeIdSource
			if (CanDeepSave(entity, "Node|DsNodeIdSource", deepSaveType, innerList) 
				&& entity.DsNodeIdSource != null)
			{
				DataRepository.NodeProvider.Save(transactionManager, entity.DsNodeIdSource);
				entity.DsNodeId = entity.DsNodeIdSource.NodeId;
			}
			#endregion 
			
			#region UsNodeIdSource
			if (CanDeepSave(entity, "Node|UsNodeIdSource", deepSaveType, innerList) 
				&& entity.UsNodeIdSource != null)
			{
				DataRepository.NodeProvider.Save(transactionManager, entity.UsNodeIdSource);
				entity.UsNodeId = entity.UsNodeIdSource.NodeId;
			}
			#endregion 
			
			#region PipeFlowTypeSource
			if (CanDeepSave(entity, "PipeFlowType|PipeFlowTypeSource", deepSaveType, innerList) 
				&& entity.PipeFlowTypeSource != null)
			{
				DataRepository.PipeFlowTypeProvider.Save(transactionManager, entity.PipeFlowTypeSource);
				entity.PipeFlowType = entity.PipeFlowTypeSource.PipeFlowTypeId;
			}
			#endregion 
			
			#region PipeShapeSource
			if (CanDeepSave(entity, "PipeShape|PipeShapeSource", deepSaveType, innerList) 
				&& entity.PipeShapeSource != null)
			{
				DataRepository.PipeShapeProvider.Save(transactionManager, entity.PipeShapeSource);
				entity.PipeShape = entity.PipeShapeSource.ShapeId;
			}
			#endregion 
			
			#region StatusSource
			if (CanDeepSave(entity, "Status|StatusSource", deepSaveType, innerList) 
				&& entity.StatusSource != null)
			{
				DataRepository.StatusProvider.Save(transactionManager, entity.StatusSource);
				entity.Status = entity.StatusSource.StatusId;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
	
			#region List<Weir>
				if (CanDeepSave(entity.WeirCollection, "List<Weir>|WeirCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Weir child in entity.WeirCollection)
					{
						if(child.LinkIdSource != null)
						{
							child.LinkId = child.LinkIdSource.LinkId;
						}
						else
						{
							child.LinkId = entity.LinkId;
						}

					}

					if (entity.WeirCollection.Count > 0 || entity.WeirCollection.DeletedItems.Count > 0)
					{
						//DataRepository.WeirProvider.Save(transactionManager, entity.WeirCollection);
						
						deepHandles.Add("WeirCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< Weir >) DataRepository.WeirProvider.DeepSave,
							new object[] { transactionManager, entity.WeirCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<Pump>
				if (CanDeepSave(entity.PumpCollection, "List<Pump>|PumpCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Pump child in entity.PumpCollection)
					{
						if(child.LinkIdSource != null)
						{
							child.LinkId = child.LinkIdSource.LinkId;
						}
						else
						{
							child.LinkId = entity.LinkId;
						}

					}

					if (entity.PumpCollection.Count > 0 || entity.PumpCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PumpProvider.Save(transactionManager, entity.PumpCollection);
						
						deepHandles.Add("PumpCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< Pump >) DataRepository.PumpProvider.DeepSave,
							new object[] { transactionManager, entity.PumpCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<Dsc>
				if (CanDeepSave(entity.DscCollectionGetByStormToLinkId, "List<Dsc>|DscCollectionGetByStormToLinkId", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Dsc child in entity.DscCollectionGetByStormToLinkId)
					{
						if(child.StormToLinkIdSource != null)
						{
							child.StormToLinkId = child.StormToLinkIdSource.LinkId;
						}
						else
						{
							child.StormToLinkId = entity.LinkId;
						}

					}

					if (entity.DscCollectionGetByStormToLinkId.Count > 0 || entity.DscCollectionGetByStormToLinkId.DeletedItems.Count > 0)
					{
						//DataRepository.DscProvider.Save(transactionManager, entity.DscCollectionGetByStormToLinkId);
						
						deepHandles.Add("DscCollectionGetByStormToLinkId",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< Dsc >) DataRepository.DscProvider.DeepSave,
							new object[] { transactionManager, entity.DscCollectionGetByStormToLinkId, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PipeConflict>
				if (CanDeepSave(entity.PipeConflictCollection, "List<PipeConflict>|PipeConflictCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PipeConflict child in entity.PipeConflictCollection)
					{
						if(child.LinkIdSource != null)
						{
							child.LinkId = child.LinkIdSource.LinkId;
						}
						else
						{
							child.LinkId = entity.LinkId;
						}

					}

					if (entity.PipeConflictCollection.Count > 0 || entity.PipeConflictCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PipeConflictProvider.Save(transactionManager, entity.PipeConflictCollection);
						
						deepHandles.Add("PipeConflictCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PipeConflict >) DataRepository.PipeConflictProvider.DeepSave,
							new object[] { transactionManager, entity.PipeConflictCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<CrossSection>
				if (CanDeepSave(entity.CrossSectionCollection, "List<CrossSection>|CrossSectionCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(CrossSection child in entity.CrossSectionCollection)
					{
						if(child.LinkIdSource != null)
						{
							child.LinkId = child.LinkIdSource.LinkId;
						}
						else
						{
							child.LinkId = entity.LinkId;
						}

					}

					if (entity.CrossSectionCollection.Count > 0 || entity.CrossSectionCollection.DeletedItems.Count > 0)
					{
						//DataRepository.CrossSectionProvider.Save(transactionManager, entity.CrossSectionCollection);
						
						deepHandles.Add("CrossSectionCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< CrossSection >) DataRepository.CrossSectionProvider.DeepSave,
							new object[] { transactionManager, entity.CrossSectionCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<Orifice>
				if (CanDeepSave(entity.OrificeCollection, "List<Orifice>|OrificeCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Orifice child in entity.OrificeCollection)
					{
						if(child.LinkIdSource != null)
						{
							child.LinkId = child.LinkIdSource.LinkId;
						}
						else
						{
							child.LinkId = entity.LinkId;
						}

					}

					if (entity.OrificeCollection.Count > 0 || entity.OrificeCollection.DeletedItems.Count > 0)
					{
						//DataRepository.OrificeProvider.Save(transactionManager, entity.OrificeCollection);
						
						deepHandles.Add("OrificeCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< Orifice >) DataRepository.OrificeProvider.DeepSave,
							new object[] { transactionManager, entity.OrificeCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<Dsc>
				if (CanDeepSave(entity.DscCollectionGetBySanToLinkId, "List<Dsc>|DscCollectionGetBySanToLinkId", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(Dsc child in entity.DscCollectionGetBySanToLinkId)
					{
						if(child.SanToLinkIdSource != null)
						{
							child.SanToLinkId = child.SanToLinkIdSource.LinkId;
						}
						else
						{
							child.SanToLinkId = entity.LinkId;
						}

					}

					if (entity.DscCollectionGetBySanToLinkId.Count > 0 || entity.DscCollectionGetBySanToLinkId.DeletedItems.Count > 0)
					{
						//DataRepository.DscProvider.Save(transactionManager, entity.DscCollectionGetBySanToLinkId);
						
						deepHandles.Add("DscCollectionGetBySanToLinkId",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< Dsc >) DataRepository.DscProvider.DeepSave,
							new object[] { transactionManager, entity.DscCollectionGetBySanToLinkId, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<DscZinger>
				if (CanDeepSave(entity.DscZingerCollection, "List<DscZinger>|DscZingerCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(DscZinger child in entity.DscZingerCollection)
					{
						if(child.LinkIdSource != null)
						{
							child.LinkId = child.LinkIdSource.LinkId;
						}
						else
						{
							child.LinkId = entity.LinkId;
						}

					}

					if (entity.DscZingerCollection.Count > 0 || entity.DscZingerCollection.DeletedItems.Count > 0)
					{
						//DataRepository.DscZingerProvider.Save(transactionManager, entity.DscZingerCollection);
						
						deepHandles.Add("DscZingerCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< DscZinger >) DataRepository.DscZingerProvider.DeepSave,
							new object[] { transactionManager, entity.DscZingerCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<SpecialLink>
				if (CanDeepSave(entity.SpecialLinkCollection, "List<SpecialLink>|SpecialLinkCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(SpecialLink child in entity.SpecialLinkCollection)
					{
						if(child.ToLinkIdSource != null)
						{
							child.ToLinkId = child.ToLinkIdSource.LinkId;
						}
						else
						{
							child.ToLinkId = entity.LinkId;
						}

					}

					if (entity.SpecialLinkCollection.Count > 0 || entity.SpecialLinkCollection.DeletedItems.Count > 0)
					{
						//DataRepository.SpecialLinkProvider.Save(transactionManager, entity.SpecialLinkCollection);
						
						deepHandles.Add("SpecialLinkCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< SpecialLink >) DataRepository.SpecialLinkProvider.DeepSave,
							new object[] { transactionManager, entity.SpecialLinkCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region LinkChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>BesAsm.MasterData.Entities.Link</c>
	///</summary>
	public enum LinkChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>HansenServiceCode</c> at HansenServiceStatusSource
		///</summary>
		[ChildEntityType(typeof(HansenServiceCode))]
		HansenServiceCode,
			
		///<summary>
		/// Composite Property for <c>LinkType</c> at LinkTypeSource
		///</summary>
		[ChildEntityType(typeof(LinkType))]
		LinkType,
			
		///<summary>
		/// Composite Property for <c>Material</c> at MaterialSource
		///</summary>
		[ChildEntityType(typeof(Material))]
		Material,
			
		///<summary>
		/// Composite Property for <c>Node</c> at DsNodeIdSource
		///</summary>
		[ChildEntityType(typeof(Node))]
		Node,
			
		///<summary>
		/// Composite Property for <c>PipeFlowType</c> at PipeFlowTypeSource
		///</summary>
		[ChildEntityType(typeof(PipeFlowType))]
		PipeFlowType,
			
		///<summary>
		/// Composite Property for <c>PipeShape</c> at PipeShapeSource
		///</summary>
		[ChildEntityType(typeof(PipeShape))]
		PipeShape,
			
		///<summary>
		/// Composite Property for <c>Status</c> at StatusSource
		///</summary>
		[ChildEntityType(typeof(Status))]
		Status,
	
		///<summary>
		/// Collection of <c>Link</c> as OneToMany for WeirCollection
		///</summary>
		[ChildEntityType(typeof(TList<Weir>))]
		WeirCollection,

		///<summary>
		/// Collection of <c>Link</c> as OneToMany for PumpCollection
		///</summary>
		[ChildEntityType(typeof(TList<Pump>))]
		PumpCollection,

		///<summary>
		/// Collection of <c>Link</c> as OneToMany for DscCollection
		///</summary>
		[ChildEntityType(typeof(TList<Dsc>))]
		DscCollectionGetByStormToLinkId,

		///<summary>
		/// Collection of <c>Link</c> as OneToMany for PipeConflictCollection
		///</summary>
		[ChildEntityType(typeof(TList<PipeConflict>))]
		PipeConflictCollection,

		///<summary>
		/// Collection of <c>Link</c> as OneToMany for CrossSectionCollection
		///</summary>
		[ChildEntityType(typeof(TList<CrossSection>))]
		CrossSectionCollection,

		///<summary>
		/// Collection of <c>Link</c> as OneToMany for OrificeCollection
		///</summary>
		[ChildEntityType(typeof(TList<Orifice>))]
		OrificeCollection,

		///<summary>
		/// Collection of <c>Link</c> as OneToMany for DscCollection
		///</summary>
		[ChildEntityType(typeof(TList<Dsc>))]
		DscCollectionGetBySanToLinkId,

		///<summary>
		/// Collection of <c>Link</c> as OneToMany for DscZingerCollection
		///</summary>
		[ChildEntityType(typeof(TList<DscZinger>))]
		DscZingerCollection,

		///<summary>
		/// Collection of <c>Link</c> as OneToMany for SpecialLinkCollection
		///</summary>
		[ChildEntityType(typeof(TList<SpecialLink>))]
		SpecialLinkCollection,
	}
	
	#endregion LinkChildEntityTypes
	
	#region LinkFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;LinkColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Link"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class LinkFilterBuilder : SqlFilterBuilder<LinkColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the LinkFilterBuilder class.
		/// </summary>
		public LinkFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the LinkFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public LinkFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the LinkFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public LinkFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion LinkFilterBuilder
	
	#region LinkParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;LinkColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Link"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class LinkParameterBuilder : ParameterizedSqlFilterBuilder<LinkColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the LinkParameterBuilder class.
		/// </summary>
		public LinkParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the LinkParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public LinkParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the LinkParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public LinkParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion LinkParameterBuilder
	
	#region LinkSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;LinkColumn&gt;"/> class
	/// that is used exclusively with a <see cref="Link"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class LinkSortBuilder : SqlSortBuilder<LinkColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the LinkSqlSortBuilder class.
		/// </summary>
		public LinkSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion LinkSortBuilder
	
} // end namespace
